class SessionsController < ApplicationController
  def new
  end

  def create
  	user = User.authenticate(session_params[:email], session_params[:password])

  	if user.nil?
  		$flash.now[:error] = "Invalid"
  		render :new
  	end
    else
    	sign_in user
    	redirect_to user
    end

  def destroy
  end

private
	def session_params
	params.require(:session).permit(:email, :password)
  	end
end
